# 在这里写上你的代码 :-)
import turtle
import math
pi = math.acos(-1)
turtle.screensize(300,200)
turtle.penup()
def six(x):#画星星，x为大小
    turtle.begin_fill()
    turtle.pendown()
    for n in range(5):
        turtle.forward(x)
        turtle.right(144)
    turtle.end_fill()
    turtle.penup()
#红色背景
turtle.pencolor("red")
turtle.fillcolor("red")
turtle.goto(-300,200)
turtle.pendown()
turtle.begin_fill()
turtle.goto(300,200)
turtle.goto(300,-200)
turtle.goto(-300,-200)
turtle.goto(-300,200)
turtle.end_fill()


turtle.pencolor("yellow")
turtle.fillcolor("yellow")
turtle.penup()

tx = -300*2/3
ty = 200*1/2
#大星星
turtle.goto(tx,200*4/5)
turtle.setheading(-72)
six(20*3/math.cos(18/180*pi)*2)

#最上面的小星星
turtle.goto(-100,160)
turtle.setheading(-90-math.atan(5/3)/pi*180)
turtle.forward(20)

turtle.right(180-18)
six(20/math.cos(18/180*pi)*2)

#右上的小星星
turtle.goto(-60,120)
turtle.setheading(-90-math.atan(7/1)/pi*180)
turtle.forward(20)
turtle.right(180-18)
six(20/math.cos(18/180*pi)*2)

#右下的小星星
turtle.goto(-60,60)
turtle.setheading(90+math.atan(7/2)/pi*180)
turtle.forward(20)
turtle.right(180-18)
six(20/math.cos(18/180*pi)*2)

#最下的小星星
turtle.goto(-100,20)
turtle.setheading(90+math.atan(5/4)/pi*180)
turtle.forward(20)
turtle.right(180-18)
six(20/math.cos(18/180*pi)*2)



#By XSYangtuo
turtle.goto(150,-290)
turtle.pencolor("black")
turtle.pendown()
turtle.write("By XSYangtuo 木益舟", align="right", font=("楷体", 12, "normal"))
turtle.penup()
turtle.goto(0,-240)
turtle.pendown()
turtle.write("中华人民共和国国旗", align="center", font=("楷体", 18, "bold"))
turtle.hideturtle()
